home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / Circle serendipity.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-23  |  1.7 KB  |  58 lines  |  [TEXT/KAHL]

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define    gap            7
  15. #define CorrectTime 2
  16.  
  17. void CircleSerendipity(GrafPtr);
  18.  
  19. /* I haven't the slightest idea why this works.  Hence the name.  -MP */
  20.  
  21. void CircleSerendipity(GrafPtr sourceGrafPtr)
  22. {
  23.     Rect        theRect;
  24.     Rect        source;
  25.     RgnHandle    curregion;
  26.     Point        zeropoint;
  27.     
  28.     source.top=source.left=0;
  29.     source.right=MAIN_WINDOW_WIDTH;
  30.     source.bottom=MAIN_WINDOW_HEIGHT;
  31.     
  32.     theRect=source;
  33.     theRect.top-=MAIN_WINDOW_HEIGHT;
  34.     OffsetRect(&theRect,0,-MAIN_WINDOW_HEIGHT);
  35.         
  36.     curregion=NewRgn();
  37.     SetEmptyRgn(curregion);
  38.     OpenRgn();
  39.         FrameOval(&theRect);
  40.     CloseRgn(curregion);
  41.     zeropoint.v=MAIN_WINDOW_HEIGHT;
  42.     zeropoint.h=0;
  43.     do
  44.     {
  45.         StartTiming();
  46.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  47.                 &source, &source, 0, curregion);
  48.         OffsetRgn(curregion, 0, gap);
  49.         TimeCorrection(CorrectTime);
  50.     }
  51.     while (!(PtInRgn(zeropoint, curregion)));
  52.  
  53.     CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  54.             &source, &source, 0, 0L);
  55.     
  56.     DisposeRgn(curregion);
  57. }
  58.